package ofpof.service.timers;

import java.util.Date;

import ofpof.domain.dao.RemembermeTokenDao;

import org.springframework.beans.factory.annotation.Autowired;

public class PasswordTokenExpiryJob {
	
	private long passwordTokenTimeout;

	@Autowired
	private RemembermeTokenDao remembermeTokenDao;
	
	public void expire() {
		Date boundaryDate = new Date(new Date().getTime()-passwordTokenTimeout);
		remembermeTokenDao.deleteOlderThan(boundaryDate);
	}
	
	public void setPasswordTokenTimeout(long passwordTokenTimeout) {
		this.passwordTokenTimeout = passwordTokenTimeout;
	}
}
